<template>
  <!-- 重大危险源信息管理 -->
  <div class="majorDangerousSourcesManager">
    <basic-container>

      <!-- 表格内容 -->
      <avue-crud
        :option="option"
        :table-loading="loading"
        :data="data"
        :page.sync="page"
        :permission="permissionList"
        :before-open="beforeOpen"
        v-model="form"
        ref="crud"
        @row-update="rowUpdate"
        @row-save="rowSave"
        @row-del="rowDel"
        @search-change="searchChange"
        @search-reset="searchReset"
        @selection-change="selectionChange"
        @current-change="currentChange"
        @size-change="sizeChange"
        @refresh-change="refreshChange"
        @on-load="onLoad"
      >
        <template slot="menuLeft">
          <el-button
            type="danger"
            size="small"
            icon="el-icon-delete"
            plain
            v-if="permission.major_dangerous_sources_delete"
            @click="handleDelete">
            删 除
          </el-button>
        </template>

        <!-- 绑定摄像头 -->
        <template slot="zdjg" slot-scope="scope">
          <el-form label-width="0px">
            <el-badge :value="(dataCAm[scope.row.id]==null?0:dataCAm[scope.row.id])" class="item">
              <el-button type="warning" size="mini" @click="handleCamera(scope.row['id'])">绑定摄像头</el-button>
            </el-badge>
          </el-form>
        </template>

        <!--查看巡检记录-->
        <template slot="cz" slot-scope="scope">
          <el-form label-width="0px">
            <td style="border: 0px">
              <el-button type="primary" size="mini" @click="handleViewXjjl(scope.row['id'])">查看巡检记录</el-button>
            </td>
          </el-form>
        </template>

        <template slot="idsLabel">
          <span style="color:#f56c6c">*</span><span>关联DCS:</span>
        </template>
        <template slot="idsForm">
          <el-form label-width="0px">
            <el-button
              type="success"
              size="small"
              @click="handleDcs">
              选择 DCS
            </el-button>
            <span v-if="dcsTagsErr" class="dsc_error" ca>请选择DCS数据点</span>
            <div class="dcs_point_list">
              <el-tag
                :key="index"
                v-for="(tag, index) in dcsTags"
                closable
                :disable-transitions="false"
                @close="closeDcsTag(index)">
                {{tag.dwbq}}
              </el-tag>
            </div>
          </el-form>
        </template>

        <!-- 地图表单自定义 -->
        <template slot="mapForm">
          <div v-if="showMap">
            <baidu-map class="map" :center="center" :zoom="zoom" @ready="handler">
              <el-input placeholder="关键词查询" v-model="searchWord" style="position:absolute;top:10px;left:10px;width:180px;">
                <template slot="append">
                  <el-button icon="el-icon-search" id="citySearch"></el-button>
                </template>
              </el-input>

              <bm-navigation anchor="BMAP_ANCHOR_TOP_RIGHT"></bm-navigation>
              <bm-marker :position="mapPosition" :dragging="true"></bm-marker>
            </baidu-map>
          </div>
        </template>

      </avue-crud>

      <!-- 巡检记录弹窗 -->
      <el-dialog
        title="巡检记录"
        append-to-body
        :visible.sync="patrolRecordDialog"
        :close-on-click-modal="false"
        :before-close="closePatrolRecordDialog"
        width="60%"
        class="patrol_record_dialog">
        <!-- 巡检表格内容 -->
        <avue-crud
          :option="patrolRecordOption"
          :table-loading="patrolRecordLoading"
          :data="patrolRecordData"
          :page.sync="patrolRecordPage"
          v-model="patrolRecordForm">
        </avue-crud>
        <!-- 按钮 -->
        <div class="modify_record_footer">
          <el-button
            type="primary"
            size="small"
            @click="closePatrolRecordDialog()">
            确 定
          </el-button>
        </div>
      </el-dialog>

      <!-- 关联DCS弹窗 -->
      <el-dialog
        title="选择 DCS"
        :visible.sync="dialogDcs"
        append-to-body
        @close='closeDialog'
        width="1200px"
      >
        <avue-crud
          :option="dcsOption"
          :table-loading="dcsLoading"
          :data="dcsData"
          :page.sync="dcsPage"
          ref="dcsCrud"
          @search-change="dcsSearchChange"
          @search-reset="dcsSearchReset"
          @selection-change="dcsSelectionChange"
          @current-change="dcsCurrentChange"
          @size-change="dcsSizeChange"
        >
          <!-- 自定义状态 -->
          <template slot="zt" slot-scope="scope">
            <div v-if="scope.row['zt'] === 1">在线</div>
            <div v-else>下线</div>
          </template>
        </avue-crud>

        <span slot="footer" class="dialog-footer">
          <el-button @click="closeDialog">取 消</el-button>
          <el-button type="primary" @click="chooseDcs()">确 定</el-button>
        </span>
      </el-dialog>

      <!-- 绑定摄像头弹窗 -->
      <el-dialog title="选择 摄像头" :visible.sync="dialogCamera" append-to-body @close='closeDialogCamera' width="1200px" class="majorDangerousSourcesManager">
        <avue-crud :option="cameraOption"
                   :table-loading="cameraLoading"
                   :data="cameraData"
                   :page.sync="cameraPage"
                   ref="cameraCrud"
                   @search-change="cameraSearchChange"
                   @search-reset="cameraSearchReset"
                   @selection-change="cameraSelectionChange"
                   @current-change="cameraCurrentChange"
                   @size-change="cameraSizeChange">
        </avue-crud>
        <span slot="footer" class="dialog-footer">
          <el-button @click="closeDialogCamera">取 消</el-button>
          <el-button type="primary" @click="chooseCamera()">确 定</el-button>
        </span>
      </el-dialog>

    </basic-container>
  </div>
</template>

<script>
  import {getList, remove, update, add, getDetail, getDCSList, getDeptList, getAnQuanFzrLinkInfo, getQuYuFzrLinkInfo, getCameraBinding, bindingCamera, getCameraBindingList, getPatrolRecordsList} from "@/api/mmhi/major_dangerous_sources";
  import {num} from "@/api/mmhi/prod_plant";
  import {mapGetters} from "vuex";

  export default {
    data() {
      return {
        form: {
        },
        query: {},
        dataCAm:{},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height: 'auto',
          calcHeight: 30,
          dialogWidth:1150,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          addBtn:false,
          editBtnText: "完善信息",
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "重大危险源名称",
              prop: "zdwxymc",
              align: "center",
              width:120,
              maxlength:50,
              row: false,
              disabled: true,
              search: true
            },
            {
              label: "重大危险源编号",
              prop: "zdwxybh",
              align: "center",
              width:120,
              maxlength:25,
              row: false,
              rules: [{
                required: true,
                message: "重大危险源编号",
                trigger: "blur"
              }]
            },
            {
              label: "危险源简称",
              prop: "wxyjc",
              align: "center",
              width:100,
              maxlength:25,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "危险源简称",
                trigger: "blur"
              }]
            },
            {
              label: "危险源类型",
              prop: "wxylx",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_wxylx",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay:true ,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危险源类型",
                trigger: "click"
              }]
            },
            {
              label: "所属部门",
              prop: "ssbm",
              align: "center",
              type:"tree",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              dicData: [],
              rules: [{
                required: true,
                message: "所属部门",
                trigger: "blur"
              }],
              props: {
                label: "title"
              }
            },
            {
              label: "负责人电话",
              prop: "fzrdh",
              align: "center",
              maxlength:11,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "负责人电话",
                trigger: "blur"
              }]
            },
            {
              label: "是否在化工园区",
              prop: "sfzhgyq",
              align: "center",
              type: "select",
              dicUrl: "/api/blade-system/dict/dictionary?code=deptInfo_yesno",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "是否在化工园区",
                trigger: "change"
              }]
            },
            {
              label: "详细地址",
              prop: "xxdz",
              align: "center",
              maxlength:100,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "详细地址",
                trigger: "blur"
              }]
            },
            {
              label: "占地面积",
              prop: "zdmj",
              align: "center",
              maxlength:50,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "占地面积",
                trigger: "blur"
              }]
            },
            {
              label: "固定资产值（万元）",
              prop: "gdzcz",
              align: "center",
              maxlength:5,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "固定资产值（万元）",
                trigger: "blur"
              }]
            },
            {
              label: "设计使用年限（年）",
              prop: "sjsynx",
              align: "center",
              maxlength:5,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "设计使用年限（年）",
                trigger: "blur"
              }]
            },
            {
              label: "存储形式",
              prop: "ccxs",
              align: "center",
              maxlength:50,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "存储形式",
                trigger: "blur"
              }]
            },
            {
              label: "检查周期（天）",
              prop: "jczq",
              align: "center",
              maxlength:5,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "检查周期（天）",
                trigger: "blur"
              }]
            },
            {
              label: "简述工艺流程",
              prop: "jsgylc",
              align: "center",
              maxlength:1000,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "简述工艺流程",
                trigger: "blur"
              }]
            },
            {
              label: "公用工程信息",
              prop: "gygcxx",
              align: "center",
              maxlength:1000,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "公用工程信息",
                trigger: "blur"
              }]
            },
            {
              label: "区域负责人",
              prop: "qyfzr",
              align: "center",
              width:100,
              change:"changeMajorUser",
              type: "select",
              dicUrl: "/api/major/getUserList",
              props: {
                value: "realName"
              },
              row: false,
              hide: true,
              filterable:true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "区域负责人",
                trigger: "change"
              }]
            },
            {
              label: "区域负责人手机",
              prop: "qyfzrsj",
              align: "center",
              width:120,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              disabled:false,
              rules: [{
                required: true,
                message: "区域负责人手机",
                trigger: "blur"
              }]
            },
            {
              label: "危害程度",
              prop: "whcd",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_whcd",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危害程度",
                trigger: "blur"
              }]
            },
            {
              label: "评审年度(年)",
              prop: "psnd",
              align: "center",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "评审年度(年)",
                trigger: "blur"
              }]
            },
            {
              label: "重大危险源描述",
              prop: "zdwxyms",
              align: "center",
              maxlength:100,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "重大危险源描述",
                trigger: "blur"
              }]
            },
            {
              label: "生产经营活动类型",
              prop: "scjyhdlx",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_scjyhdlx",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "生产经营活动类型",
                trigger: "blur"
              }]
            },
            {
              label: "生产存储场所产权",
              prop: "sccccscq",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_sccccscq",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "生产存储场所产权",
                trigger: "blur"
              }]
            },
            {
              label: "防雷防静电设施是否定期接受检测",
              prop: "flfjdsssfdqjsjc",
              align: "center",
              type: "select",
              dicUrl: "/api/blade-system/dict/dictionary?code=deptInfo_yesno",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                    required: true,
                    message: "防雷防静电设施是否定期接受检测",
                    trigger: "change"
                  }]
            },
            {
              label: "涉及危险工艺",
              prop: "sjwxgy",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_sjwxgy",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "涉及危险工艺",
                trigger: "blur"
              }]
            },
            {
              label: "环境位置",
              prop: "hjwz",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_hjwz",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "环境位置",
                trigger: "blur"
              }]
            },
            {
              label: "投用日期",
              prop: "tyrq",
              align: "center",
              type:"datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              row: true,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "投用日期",
                trigger: "click"
              }]
            },
            {
              label: "重大危险源级别",
              width: "130px",
              type: "select",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=hazardChemical_zdwxydj",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              prop: "zdwxyjb",
              align: "center",
              search: true,
              disabled: true,
            },
            {
              label: "R值",
              prop: "rz",
              align: "center",
              maxlength:6,
              row: false,
              disabled: true,
            },
            {
              label: "厂区人数",
              prop: "cqrs",
              align: "center",
              row: false,
              rules: [{
                required: true,
                message: "厂区人数",
                trigger: "blur"
              }]
            },
            {
              label: "安全负责人",
              prop: "aqfzraqfzr",
              align: "center",
              width:100,
              type: "select",
              dicUrl: "/api/major/getUserList",
              props: {
                value: "realName",
              },
              row: false,
              filterable:true,
              rules: [{
                required: true,
                message: "安全负责人",
                trigger: "blur"
              }]
            },
            {
              label: "安全负责人手机",
              prop: "aqfzrsj",
              width:120,
              align: "center",
              row: false,
              disabled:false,
              rules: [{
                required: true,
                message: "安全负责人手机",
                trigger: "blur"
              }]
            },
            {
              label: "压力容器总数",
              prop: "ylrqzs",
              align: "center",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "压力容器总数",
                trigger: "blur"
              }]
            },
            {
              label: "防雷防静电设施检测时间(最近一次检测时间)",
              prop: "flfjdzj",
              align: "center",
              type:"datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "防雷防静电设施检测时间：最近一次检测时间",
                trigger: "click"
              }]
            },
            {
              label: "防雷防静电设施检测时间(到期时间)",
              prop: "flfjddq",
              align: "center",
              type:"datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "防雷防静电设施检测时间：到期时间",
                trigger: "click"
              }]
            },
            {
              label: "危险源备案期限（开始）",
              prop: "wxybaqx1",
              align: "center",
              type:"datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              dateBtn:true,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危险源备案期限（开始）",
                trigger: "blur"
              }]
            },
            {
              label: "危险源备案期限（结束）",
              prop: "wxybaqx2",
              align: "center",
              type:"datetime",
              format: "yyyy-MM-dd hh:mm:ss",
              valueFormat: "yyyy-MM-dd hh:mm:ss",
              dateBtn:true,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危险源备案期限（结束）",
                trigger: "blur"
              }]
            },
            {
              label: "单元内涉及的危险化学品",
              prop: "dynsjdwxhxp",
              align: "center",
              maxlength:250,
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "单元内涉及的危险化学品",
                trigger: "blur"
              }]
            },
            {
              label: "危险化学品存量",
              prop: "wxhxpcl",
              align: "center",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危险化学品存量",
                trigger: "blur"
              }]
            },
            {
              label: "危险化学品性质",
              prop: "wxhxpxz",
              align: "center",
              type:"select",
              dicUrl: "/api/blade-system/dict/dictionary?code=majordangerous_wxhxpxz",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "危险化学品性质",
                trigger: "blur"
              }]
            },
            {
              label: "所处装置或区域",
              prop: "sczzhqy",
              align: "center",
              maxlength:100,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "所处装置或区域",
                trigger: "blur"
              }]
            },
            {
              label: "存在量",
              prop: "czl",
              hide: true,
              rules: [{
                required: false,
                message: "存在量",
                trigger: "blur"
              }]
            },
            {
              label: "周边环境类型",
              prop: "zbhjlx",
              align: "center",
              maxlength:100,
              hide: true,
              rules: [{
                required: false,
                message: "周边环境类型",
                trigger: "blur"
              }]
            },
            {
              label: "周边环境名称",
              prop: "zbhjmc",
              align: "center",
              maxlength:100,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "周边环境名称",
                trigger: "blur"
              }]
            },
            {
              label: "周边环境人数",
              prop: "zbhjrs",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "周边环境人数",
                trigger: "blur"
              }]
            },
            {
              label: "与危险源最近距离",
              prop: "ywxyzjjl",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "与危险源最近距离",
                trigger: "blur"
              }]
            },
            {
              label: "重大危险源周边安全间距",
              prop: "zdwxyzbaqjj",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "重大危险源周边安全间距",
                trigger: "blur"
              }]
            },
            {
              label: "周边环境联系人",
              prop: "zbhjlxr",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "周边环境联系人",
                trigger: "blur"
              }]
            },
            {
              label: "周边环境联系人电话",
              prop: "zbhjlxrdh",
              align: "center",
              maxlength:11,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "周边环境联系人电话",
                trigger: "blur"
              }]
            },
            {
              label: "周边防护目标最近距离（米）",
              prop: "zbfhmbzjjl",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "周边防护目标最近距离（米）",
                trigger: "blur"
              }]
            },
            {
              label: "外边界500米范围人数估算",
              prop: "wbj500mfwlrsgs",
              align: "center",
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: false,
                message: "外边界500米范围人数估算",
                trigger: "blur"
              }]
            },
            {
              label: '',
              prop: 'map',
              span: 24,
              hide: true,
              formslot: true,
            },
            {
              label: "经度",
              prop: "jd",
              align: "center",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "经度",
                trigger: "blur"
              }]
            },
            {
              label: "纬度",
              prop: "wd",
              align: "center",
              row: false,
              hide: true,
              addDisplay: true,
              editDisplay: true,
              viewDisplay: true,
              rules: [{
                required: true,
                message: "纬度",
                trigger: "blur"
              }]
            },
            {
              label: "租户Id",
              prop: "tenantId",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "企业部门Id",
              prop: "bladeDeptId",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "创建人",
              prop: "createUser",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "创建部门",
              prop: "createDept",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "创建时间",
              prop: "createTime",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "危化品管理信息id",
              prop: "hazardChemicalManageId",
              align: "center",
              row: false,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
            },
            {
              label: "重点监管",
              prop: "zdjg",
              width:"120px",
              slot: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              hide: false,
              align: "center"
            },
            {
              label: "DCS点",
              prop: "dwbq",
              align: "center",
              hide: true,
              addDisplay: false,
              viewDisplay: false,
              editDisplay: false
            },
            {
              label: "关联DCS",
              prop: "ids",
              align: "center",
              hide: true,
              viewDisplay: false,
              formslot:true,
              labelslot:true
            },
            {
              label: "操作",
              width:"125px",
              prop: "cz",
              align: "center",
              slot: true,
              hide: false,
              viewDisplay: false,
              addDisplay: false,
              editDisplay: false
            },
          ]
        },
        data: [],
        mapPosition: {
          lng: 121.4472540000,
          lat: 31.3236200000
        },
        center: {
          lng: 121.4472540000,
          lat: 31.3236200000
        },
        zoom: 10,
        dragging: false,
        showMap: true,
        searchWord: "",

        dialogDcs: false,
        dcsQuery: {},
        dcsLoading: true,
        dcsPage: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        dcsSelectionList: [],
        dcsOption: {
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          menu: false,
          addBtn: false,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          refreshBtn: false,
          columnBtn: false,
          column: [
            {
              label: "点位标签",
              prop: "dwbq",
              align: "center",
              search: true,
              rules: [{
                required: true,
                message: "请输入点位标签",
                trigger: "blur"
              }]
            },
            {
              label: "点位名称",
              prop: "dwmc",
              align: "center",
              search: true,
              rules: [{
                required: true,
                message: "请输入点位名称",
                trigger: "blur"
              }]
            },
            {
              label: "点位类型",
              prop: "dwlx",
              align: "center",
              type: 'select',
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=dcs_data_site_type",
              props: {
                label: "dictValue",
                value: "dictKey",
              },
              rules: [{
                required: true,
                message: "请选择点位类型",
                trigger: "blur"
              }]
            },
            {
              label: "最大值",
              prop: "zdfz",
              align: "center",
              type: "number",
              rules: [{
                required: true,
                message: "请输入最大值",
                trigger: "blur"
              }]
            },
            {
              label: "最小值",
              prop: "zxfz",
              align: "center",
              type: "number",
              rules: [{
                required: true,
                message: "请输入最小值",
                trigger: "blur"
              }]
            },
            {
              label: "单位",
              prop: "dw",
              align: "center",
              rules: [{
                required: true,
                message: "请输入单位",
                trigger: "blur"
              }]
            },
            {
              label: "状态",
              prop: "zt",
              align: "center",
              slot: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false
            },

          ]
        },
        dcsData: [],
        dcsTags: [],
        dcsTagsErr: false,
        selectDcs: {},

        dialogCamera: false,
        cameraQuery: {},
        cameraLoading: true,
        cameraPage: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        cameraSelectionList: [],
        cameraOption: {
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          menu: false,
          addBtn: false,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          refreshBtn: false,
          columnBtn: false,
          column: [
            {
              label: "摄像头名称",
              prop: "sxtmc",
              align: "center",
              search: true
            },
            {
              label: "摄像头ID",
              prop: "sxtid",
              align: "center"
            },
            {
              label: "安装位置",
              prop: "azwz",
              align: "center"
            },
            {
              label: "所属区域",
              prop: "ssqy",
              align: "center"
            }
          ]
        },

        cameraData: [],
        selectCamera: {},
        dataCameraBindingList: [],

        // 查看巡检记录弹窗
        patrolRecordDialog: false,
        currentId: "",
        patrolRecordForm: {},
        patrolRecordLoading: true,
        patrolRecordQuery: {},
        patrolRecordData: [],
        patrolRecordPage: {
          pageSize: this.$pageSize,
          currentPage: 1,
          total: 0
        },
        patrolRecordOption: {
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          viewBtn: true,
          dialogClickModal: false,
          calcHeight: 30,
          tip: false,
          index: true,
          selection: false,
          addBtn: false,
          refreshBtn: false,
          columnBtn: false,
          menu: false,
          column: [
            {
              label: "巡检点名称",
              prop: "rwmc",
              align: "center",
              width:"100px",
            },
            {
              label: "巡检人",
              prop: "xjr",
              align: "center",
              width:"60px",
            },
            {
              label: "所在部门",
              prop: "szbm",
              align: "center",
              width:"90px",
            },
            {
              label: "检查频次",
              prop: "jcpc",
              align: "center",
              width:"80px",
            },
            {
              label: "巡检生产区域",
              prop: "xjscqy",
              align: "center",
              width:"100px",
            },
            {
              label: "巡检设备设施",
              prop: "xjsbss",
              align: "center",
              width:"100px",
            },
            {
              label: "巡检时间",
              prop: "xjsj",
              align: "center",
              width:140,
              type: "datetime",
              format: "yyyy-MM-dd HH:mm:ss",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
            },
            {
              label: "巡检隐患描述",
              prop: "xjyhms",
              align: "center",
              width:140,
            },
            {
              label: "巡检结果",
              prop: "xjjg",
              align: "center",
              width:"80px",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=patrol_point_management_xjjg",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType:"number",
            },
            {
              label: "状态",
              display: false,
              prop: "zt",
              align: "center",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=patrol_point_management_zt",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType:"number",
            },
            {
              label: "核实人",
              prop: "hsr",
              align: "center",
              dicUrl: "/api/emerRectify/rectify/getPersonInfo",
              props: {
                label: "name",
                value: "id",
              },
              width:"60px",
            },
            {
              label: "巡检隐患级别",
              prop: "xjyhjb",
              align: "center",
              width:"120px",
              dicUrl: "/api/blade-system/dict-biz/dictionary?code=patrol_point_management_xjyhjb",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              addDisplay: false,
              dataType:"number"
            }
          ]
        },

        //重大危险源信息监管id
        productionSiteBindingId: []

      };
    },
    computed: {
      ...mapGetters(["permission"]),
      // 表格按钮权限
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.major_dangerous_sources_add, false),
          viewBtn: this.vaildData(this.permission.major_dangerous_sources_view, false),
          delBtn: this.vaildData(this.permission.major_dangerous_sources_delete, false),
          editBtn: this.vaildData(this.permission.major_dangerous_sources_edit, false)
        };
      },
      // 勾选项id
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    watch: {

      // 表单经度
      'form.jd' (val) {
        if(val) {
          this.mapPosition.lng = val / 1
        }
      },

      // 表单纬度
      'form.wd' (val) {
        if(val) {
          this.mapPosition.lat = val / 1
        }
      },

      // form是表单或者表格绑定的数据集，v-model='form'
      'form.aqfzraqfzr':{
        handler(val){
          if(val!='' && val!=undefined && val!=null){
            // 可以请求后端的方法
            getAnQuanFzrLinkInfo(val).then(res=>{
              this.form. aqfzrsj = res.data.data[0].phone
            });
          }
        },
        immediate: true
      },

      // form是表单或者表格绑定的数据集，v-model='form'
      'form.qyfzr':{
        handler(val){
          if(val!='' && val!=undefined && val!=null){
            // 可以请求后端的方法
            getQuYuFzrLinkInfo(val).then(res=>{
              this.form. qyfzrsj = res.data.data[0].phone
            });
          }
        },
        immediate: true
      }
    },
    mounted() {
      this.initData();
    },
    methods: {
      // 初始化数据
      initData() {
        var tenantId = JSON.parse( localStorage.getItem("saber-tenantId") ).content;
        getDeptList(tenantId).then(res => {
          const column = this.findObject(this.option.column, "ssbm");
          column.dicData = res.data.data;
        }).then(() => {
        });
      },
      // 地图处理事件
      handler({BMap, map}) {
        let _this = this;
        map.addEventListener('click', function(e) {
          _this.form.jd = e.point.lng
          _this.form.wd = e.point.lat
        });

        _this.$nextTick(() => {
          document.getElementById('citySearch').addEventListener('click', function() {
            let localSearch = new BMap.LocalSearch(map)
            localSearch.setSearchCompleteCallback(searchResult => {
              let poi = searchResult.getPoi(0)
              if(!poi) {
                return _this.$message.warning('该地址不存在')
              } else {
                _this.center = {
                  lng: poi.point.lng,
                  lat: poi.point.lat
                }
                _this.form.jd = poi.point.lng
                _this.form.wd = poi.point.lat
              }
            });
            localSearch.search(_this.searchWord);
          });
        })
      },

      //查看巡检记录
      handleViewXjjl(row) {
        this.currentId ='';
        this.currentId = row;
        this.patrolRecordDialog = true;
        this.patrolRecordData = [];
        this.patrolRecordPage.currentPage = 1;
        this.patrolRecordOnLoad(this.patrolRecordPage);
      },

      // 获取巡检记录列表
      patrolRecordOnLoad(page, params = {}) {
        this.patrolRecordLoading = true;
        params.id=this.currentId
        getPatrolRecordsList(page.currentPage, page.pageSize, Object.assign(params, this.patrolRecordQuery)).then(res => {
          let resData = res.data.data;
          this.patrolRecordPage.total = resData.total;
          this.patrolRecordData = resData.records;
          this.patrolRecordLoading = false;
        });
      },

      // 确认、取消、关闭巡检记录记录弹窗
      closePatrolRecordDialog() {
        this.patrolRecordDialog = false;
        this.currentId = "";
      },

      // 打开选择DCS弹窗
      handleDcs() {
        this.dialogDcs = true;
        this.dcsOnLoad(this.dcsPage);
      },

      // 关闭选择DCS弹窗
      closeDialog() {
        this.dcsPage.currentPage = 1;
        this.dialogDcs = false;
        this.dcsSelectionClear();
      },

      // DCS获取表格数据
      dcsOnLoad(page, params = {}) {
        this.dcsLoading = true;
        getDCSList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.dcsPage.total = data.total;
          this.dcsData = data.records;
          this.dcsLoading = false;
          if(this.selectDcs !== undefined && JSON.stringify(this.selectDcs) !== "{}" && this.dcsTags.length !== 0) {
            this.$nextTick(() => {
              this.dcsData.forEach(row => {
                if(this.selectDcs[row.id] !== undefined&&this.selectDcs[row.id]!=null) {
                  this.$refs.dcsCrud.toggleRowSelection(row, true);
                }
              })
            })
          }
        });
      },

      // DCS清空勾选
      dcsSelectionClear() {
        this.dcsSelectionList = [];
        this.$refs.dcsCrud.toggleSelection();
      },

      // DCS搜索条件改变事件
      dcsSearchChange(params, done) {
        this.dcsQuery = params;
        this.dcsPage.currentPage = 1;
        this.dcsOnLoad(this.dcsPage, params);
        done();
      },

      // DCS清空搜索条件
      dcsSearchReset() {
        this.dcsQuery = {};
        this.dcsOnLoad(this.dcsPage);
      },

      // DCS勾选
      dcsSelectionChange(list) {
        this.dcsSelectionList = list;
      },

      // DCS换页数
      dcsCurrentChange(currentPage){
        var pageSelectIds = [];
        var pageAllIds = [];
        this.dcsSelectionList.forEach(item => {
          this.selectDcs[item.id] = item;
          pageSelectIds.push(item.id);
        });
        this.dcsData.forEach(item => {
          pageAllIds.push(item.id);
        });
        for(var id in this.selectDcs) {
          if(pageSelectIds.indexOf(id) < 0 && pageAllIds.indexOf(id) >= 0) {
            delete this.selectDcs[id];
          }
        }
        this.dcsPage.currentPage = currentPage;
        this.dcsOnLoad(this.dcsPage);
      },

      // DCS换每页显示数量
      dcsSizeChange(pageSize){
        this.dcsPage.pageSize = pageSize;
        this.dcsOnLoad(this.dcsPage);
      },

      // 选择DCS
      chooseDcs() {
        var pageSelectIds = [];
        var pageAllIds = [];
        this.dcsSelectionList.forEach(item => {
          this.selectDcs[item.id] = item;
          pageSelectIds.push(item.id);
        });
        this.dcsData.forEach(item => {
          pageAllIds.push(item.id);
        });
        for(let id in this.selectDcs) {
          if(pageSelectIds.indexOf(id) < 0 && pageAllIds.indexOf(id) >= 0) {
            delete this.selectDcs[id];
          }
        }
        if(this.selectDcs === undefined || JSON.stringify(this.selectDcs) === "{}") {
          this.$message.warning("请选择DCS数据点");
          return;
        }
        this.dcsTagsErr = false;
        this.dcsTags = [];
        for(let id in this.selectDcs) {
          this.dcsTags.push(this.selectDcs[id]);
        }
        this.closeDialog();
      },

      // 删除某一个dcs标签
      closeDcsTag(index) {
        this.dcsTags.splice(index, 1);
        if(this.dcsTags.length === 0) {
          this.dcsTagsErr = true;
        }
        for(let id in this.selectDcs) {
          if(this.dcsTags[id]!=this.selectDcs[id]) {
            console.log(this.dcsTags[id])
            // console.log(this.selectQuestion[id])
            this.selectDcs[id]=null;
            break;
          }
        }
        console.log(this.dcsTags);
        console.log(this.selectDcs);
      },

      // 打开绑定摄像头弹窗
      handleCamera(id) {
        this.productionSiteBindingId = id;
        this.dialogCamera = true;
        //调用获取对应绑定摄像头集合
        getCameraBindingList(id, 6).then((data) => {
          this.dataCameraBindingList=data.data.data
        });
        this.cameraOnLoad(this.cameraPage);
      },

      // 关闭绑定摄像头弹窗
      closeDialogCamera() {
        this.cameraPage.currentPage = 1;
        this.dialogCamera = false;
        this.cameraSelectionClear();
      },

      // 摄像头获取表格数据
      cameraOnLoad(page, params = {}) {
        this.cameraLoading = true;
        getCameraBinding(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.cameraPage.total = data.total;
          this.cameraData = data.records;
          this.cameraLoading = false;
          console.log(this.selectCamera);
          this.$nextTick(() => {
            this.cameraData.forEach(row => {
              this.dataCameraBindingList.forEach(item => {
                if(item.cameraId===row.id){
                  this.$refs.cameraCrud.toggleRowSelection(row, true);
                }
              })
            })
          })
        });
      },

      // 绑定摄像头清空勾选
      cameraSelectionClear() {
        this.cameraSelectionList = [];
        this.$refs.cameraCrud.toggleSelection();
      },

      // 摄像头搜索条件改变事件
      cameraSearchChange(params, done) {
        this.cameraQuery = params;
        this.cameraPage.currentPage = 1;
        this.cameraOnLoad(this.cameraPage, params);
        done();
      },

      // 摄像头清空搜索条件
      cameraSearchReset() {
        this.cameraQuery = {};
        this.cameraOnLoad(this.cameraPage);
      },

      // 摄像头勾选
      cameraSelectionChange(list) {
        this.cameraSelectionList = list;
      },

      // 摄像头换页数
      cameraCurrentChange(currentPage){
        var pageSelectIds = [];
        var pageAllIds = [];
        this.cameraSelectionList.forEach(item => {
          this.selectCamera[item.id] = item;
          pageSelectIds.push(item.id);
        });
        this.cameraData.forEach(item => {
          pageAllIds.push(item.id);
        });
        for(var id in this.selectCamera) {
          if(pageSelectIds.indexOf(id) < 0 && pageAllIds.indexOf(id) >= 0) {
            delete this.selectCamera[id];
          }
        }
        this.cameraPage.currentPage = currentPage;
        this.cameraOnLoad(this.cameraPage);
      },

      // 摄像头换每页显示数量
      cameraSizeChange(pageSize){
        this.cameraPage.pageSize = pageSize;
        this.cameraOnLoad(this.cameraPage);
      },

      // 选择摄像头
      chooseCamera(loading) {
        var pageSelectIds = [];
        var pageAllIds = [];
        this.cameraSelectionList.forEach(item => {
          this.selectCamera[item.id] = item;
          pageSelectIds.push(item.id);
        });
        this.cameraData.forEach(item => {
          pageAllIds.push(item.id);
        });
        for(let id in this.selectCamera) {
          if(pageSelectIds.indexOf(id) < 0 && pageAllIds.indexOf(id) >= 0) {
            delete this.selectCamera[id];
          }
        }

        var ids = pageSelectIds.join(",");
        var id = this.productionSiteBindingId;
        bindingCamera(ids,id).then(() => {
          this.closeDialogCamera();
          this.onLoad(this.page);
          this.$message.success("绑定成功!");
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      // 新增
      rowSave(row, done, loading) {
        if (row.wxybaqx1>row.wxybaqx2){
          console.log(row.wxybaqx2)
          console.log(row.wxybaqx2)
          this.$message.warning("危险源备案结束期限填写错误,需大于危险源备案开始期限");
          loading();
          return
        }
        if(this.dcsTags.length === 0) {
          this.dcsTagsErr = true;
          loading();
          return;
        }
        delete row.dwbq;
        var idsArr = [];
        this.dcsTags.forEach(item => {
          idsArr.push(item.id);
        });
        row.ids = idsArr.join(",");
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message.success("操作成功!");
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },

      //获取绑定数
      getNum() {
        num().then((data) => {
          this.dataCAm=data.data.data
        }, error => {
          window.console.log(error);
        });
      },
      // 编辑
      rowUpdate(row, index, done, loading) {
        if (row.wxybaqx1>row.wxybaqx2){
          console.log(row.wxybaqx2)
          console.log(row.wxybaqx2)
          this.$message.warning("危险源备案结束期限填写错误,需大于危险源备案开始期限");
          loading();
          return
        }
        if(this.dcsTags.length === 0) {
          this.dcsTagsErr = true;
          loading();
          return;
        }
        var idsArr = [];
        var updateData = {
          tenantId:row.tenantId,
          bladeDeptId:row.bladeDeptId,
          createUser:row.createUser,
          createDept:row.createDept,
          createTime:row.createTime,
          id: row.id,
          ssbm: row.ssbm,
          zdwxybh: row.zdwxybh,
          zdwxymc: row.zdwxymc,
          wxyjc: row.wxyjc,
          wxylx: row.wxylx,
          fzrdh: row.fzrdh,
          sfzhgyq: row.sfzhgyq,
          xxdz: row.xxdz,
          zdmj: row.zdmj,
          gdzcz: row.gdzcz,
          sjsynx: row.sjsynx,
          ccxs: row.ccxs,
          jczq: row.jczq,
          jsgylc: row.jsgylc,
          gygcxx: row.gygcxx,
          cqrs: row.cqrs,
          aqfzraqfzr: row.aqfzraqfzr,
          aqfzrsj: row.aqfzrsj,
          qyfzr: row.qyfzr,
          qyfzrsj: row.qyfzrsj,
          whcd: row.whcd,
          psnd: row.psnd,
          zdwxyms: row.zdwxyms,
          scjyhdlx: row.scjyhdlx,
          sccccscq: row.sccccscq,
          flfjdsssfdqjsjc: row.flfjdsssfdqjsjc,
          sjwxgy: row.sjwxgy,
          hjwz: row.hjwz,
          tyrq: row.tyrq,
          rz: row.rz,
          zdwxyjb: row.zdwxyjb,
          ylrqzs: row.ylrqzs,
          flfjdzj: row.flfjdzj,
          flfjddq: row.flfjddq,
          wxybaqx1: row.wxybaqx1,
          wxybaqx2: row.wxybaqx2,
          dynsjdwxhxp: row.dynsjdwxhxp,
          wxhxpcl: row.wxhxpcl,
          wxhxpxz: row.wxhxpxz,
          sczzhqy: row.sczzhqy,
          czl: row.czl,
          zbhjlx: row.zbhjlx,
          zbhjmc: row.zbhjmc,
          zbhjrs: row.zbhjrs,
          ywxyzjjl: row.ywxyzjjl,
          zdwxyzbaqjj: row.zdwxyzbaqjj,
          zbhjlxr: row.zbhjlxr,
          zbhjlxrdh: row.zbhjlxrdh,
          zbfhmbzjjl: row.zbfhmbzjjl,
          wbj500mfwlrsgs: row.wbj500mfwlrsgs,
          jd: row.jd,
          wd: row.wd,
          dwbq: row.dwbq,
          dwmc: row.dwmc,
          zdfz: row.zdfz,
          zxfz: row.zxfz,
          dwlx: row.dwlx,
          dw: row.dw,
          zt: row.zt,
          hazardChemicalManageId: row.hazardChemicalManageId,
          ids: ""
        };
        this.dcsTags.forEach(item => {
          idsArr.push(item.id);
        });
        updateData.ids = idsArr.join(",");
        update(updateData).then(() => {
          this.onLoad(this.page);
          this.$message.success("操作成功!");
          done();
        },error => {
          window.console.log(error);
          loading();
        });
      },
      // 删除一条
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      // 清空搜索条件
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },

      // 删除多条
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      // 打开弹窗前
      beforeOpen(done, type) {
        this.dcsTagsErr = false;
        this.dcsTags = [];
        this.selectDcs = {};
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
            this.form.dcsDataSiteInfos.forEach(item => {
              this.dcsTags.push(item);
              this.selectDcs[item.id] = item;
            });
          });
        }
        done();
      },
      // 搜索条件改变事件
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      // 勾选
      selectionChange(list) {
        this.selectionList = list;
      },
      // 清空勾选
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      // 换页数
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      // 换每页显示数量
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      // 刷新
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      // 获取表格数据
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params,this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
          this.getNum();
        });
      }
    }
  };
</script>


<style lang="scss">
  .majorDangerousSourcesManager {
    .el-form-item__label {
      width: 120px !important;
    }

    .avue-form__row {
      .el-form-item__content {
        margin-left: 120px !important;
      }
    }
  }
  .dsc_error {
    color: red;
  }
  .item {
    margin-top: 9px;
    margin-right: 40px;
  }
</style>

<style lang="scss" scpoed>
  .avue-crud__dialog {
    .el-dialog__body {
      .el-form-item__label {
        width: 190px !important;
      }

      .avue-form__row {
        .el-form-item__content {
          margin-left: 190px !important;
        }
      }
    }
  }
  .map {
    width: 100%;
    height: 500px;
  }

  .el-dialog__wrapper {
    .el-dialog__body {
      padding: 10px 20px 20px 20px;

      .el-form-item__label {
        width: 72px;
      }

      .avue-form__row {
        .el-form-item__content {
          margin-left: 72px;
        }
      }

      .avue-crud__menu {
        display: none;
      }
    }
  }

  .dcs_error {
    color: #F56C6C;
    font-size: 12px;
    margin-left: 5px;
  }

  .dcs_point_list {
    margin-top: 5px;

    .el-tag {
      margin-right: 5px;
    }
  }
</style>
